public class code_5 {
    public int maxArea(int[] height) {
        // 一直移动最小的那一边
        int max = 0;
        int n = height.length;
        int left=0,right=n-1;
        while (left<right){
            int flag = Math.min(height[left],height[right]);//找到最小边
            max = Math.max(max,flag*(right-left));
            if(height[left]<height[right]) left++;
            else right--;
        }
        return max;
    }
}
